#include"DecodeMessageBuffer.h"
#include"pbc/pbc.h"
#include"MessageConst.h"
#include<iostream>
#include<string>

DecodeMessageBuffer::DecodeMessageBuffer()
{
    initDecodeFunc();
}

DecodeMessageBuffer::~DecodeMessageBuffer()
{
    m_decodeFuncMaps.clear();
}

void DecodeMessageBuffer::decode(char* buff, int len, pbc_env* env, Json::Value* out)
{
    short id;
    memcpy(&id, buff, sizeof(id));
    auto iter = m_decodeFuncMaps.find(id);
    (*out)["messageid"] = id;
    if (iter != m_decodeFuncMaps.end())
    {
        (this->*(iter->second))(buff + 2, len - sizeof(id), env, out);
    }
}

void DecodeMessageBuffer::registerDecodeFunc(int id, DecodeFunc func)
{
    m_decodeFuncMaps[id] = func;
}


void DecodeMessageBuffer::decodeC2S_Login(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_Login", &slice);


    std::string userName = pbc_rmessage_string(pbc_rmsg, "userName", 0, NULL);
    (*out)["userName"] = userName;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_GetAllMail(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_GetAllMail", &slice);


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_ReceivetMail(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_ReceivetMail", &slice);


    int id = pbc_rmessage_integer(pbc_rmsg, "id", 0, NULL);
    (*out)["id"] = id;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_GetMail(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_GetMail", &slice);


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_GM_Excute(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_GM_Excute", &slice);


    std::string cmd = pbc_rmessage_string(pbc_rmsg, "cmd", 0, NULL);
    (*out)["cmd"] = cmd;


    int type = pbc_rmessage_integer(pbc_rmsg, "type", 0, NULL);
    (*out)["type"] = type;


    int value = pbc_rmessage_integer(pbc_rmsg, "value", 0, NULL);
    (*out)["value"] = value;


    int size = pbc_rmessage_integer(pbc_rmsg, "size", 0, NULL);
    (*out)["size"] = size;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_Register_User(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_Register_User", &slice);


    std::string usrName = pbc_rmessage_string(pbc_rmsg, "usrName", 0, NULL);
    (*out)["usrName"] = usrName;


    std::string usrPsw = pbc_rmessage_string(pbc_rmsg, "usrPsw", 0, NULL);
    (*out)["usrPsw"] = usrPsw;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_GM_CMD(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_GM_CMD", &slice);


    int id = pbc_rmessage_integer(pbc_rmsg, "id", 0, NULL);
    (*out)["id"] = id;


    {
        struct pbc_rmessage* mail = pbc_rmessage_message(pbc_rmsg, "mail", 0);
        (*out)["mail"] = Json::Value();

        int id = pbc_rmessage_integer(mail, "id", 0, NULL);
        (*out)["mail"]["id"] = id;


        std::string title = pbc_rmessage_string(mail, "title", 0, NULL);
        (*out)["mail"]["title"] = title;


        std::string content = pbc_rmessage_string(mail, "content", 0, NULL);
        (*out)["mail"]["content"] = content;


        {
            int awards_n = pbc_rmessage_size(mail, "awards");
            for (int awards_i = 0; awards_i < awards_n; ++awards_i)
            {
                struct pbc_rmessage* awards = pbc_rmessage_message(mail, "awards", awards_i);

                (*out)["mail"]["awards"] = Json::Value();
                Json::Value arrValue;

                int type = pbc_rmessage_integer(awards, "type", awards_i, NULL);
                arrValue["type"] = type;


                int value = pbc_rmessage_integer(awards, "value", awards_i, NULL);
                arrValue["value"] = value;


                int size = pbc_rmessage_integer(awards, "size", awards_i, NULL);
                arrValue["size"] = size;

                (*out)["mail"]["awards"].append(arrValue);
            }
        }
    }

    {
        int gmcmd_n = pbc_rmessage_size(pbc_rmsg, "gmcmd");
        for (int gmcmd_i = 0; gmcmd_i < gmcmd_n; ++gmcmd_i)
        {
            struct pbc_rmessage* gmcmd = pbc_rmessage_message(pbc_rmsg, "gmcmd", gmcmd_i);

            (*out)["gmcmd"] = Json::Value();
            Json::Value arrValue;

            std::string cmd = pbc_rmessage_string(gmcmd, "cmd", gmcmd_i, NULL);
            arrValue["cmd"] = cmd;


            int type = pbc_rmessage_integer(gmcmd, "type", gmcmd_i, NULL);
            arrValue["type"] = type;


            int param = pbc_rmessage_integer(gmcmd, "param", gmcmd_i, NULL);
            arrValue["param"] = param;

            (*out)["gmcmd"].append(arrValue);
        }
    }

    int specials_n = pbc_rmessage_size(pbc_rmsg, "specials");
    Json::Value specialsArr;
    for (int specials_i = 0; specials_i < specials_n; ++specials_i)
    {
        int specials_v = pbc_rmessage_integer(pbc_rmsg, "specials", specials_i, NULL);
        specialsArr.append(specials_v);
    }
    (*out)["specials"] = specialsArr;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_UpdatePos(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_UpdatePos", &slice);


    int sceneId = pbc_rmessage_integer(pbc_rmsg, "sceneId", 0, NULL);
    (*out)["sceneId"] = sceneId;


    {
        struct pbc_rmessage* forward = pbc_rmessage_message(pbc_rmsg, "forward", 0);
        (*out)["forward"] = Json::Value();

        double x = pbc_rmessage_real(forward, "x", 0);
        (*out)["forward"]["x"] = x;


        double y = pbc_rmessage_real(forward, "y", 0);
        (*out)["forward"]["y"] = y;


        double z = pbc_rmessage_real(forward, "z", 0);
        (*out)["forward"]["z"] = z;

    }

    {
        struct pbc_rmessage* pos = pbc_rmessage_message(pbc_rmsg, "pos", 0);
        (*out)["pos"] = Json::Value();

        double x = pbc_rmessage_real(pos, "x", 0);
        (*out)["pos"]["x"] = x;


        double y = pbc_rmessage_real(pos, "y", 0);
        (*out)["pos"]["y"] = y;


        double z = pbc_rmessage_real(pos, "z", 0);
        (*out)["pos"]["z"] = z;

    }

    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_UpdateVelocity(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_UpdateVelocity", &slice);


    int sceneId = pbc_rmessage_integer(pbc_rmsg, "sceneId", 0, NULL);
    (*out)["sceneId"] = sceneId;


    {
        struct pbc_rmessage* pos = pbc_rmessage_message(pbc_rmsg, "pos", 0);
        (*out)["pos"] = Json::Value();

        double x = pbc_rmessage_real(pos, "x", 0);
        (*out)["pos"]["x"] = x;


        double y = pbc_rmessage_real(pos, "y", 0);
        (*out)["pos"]["y"] = y;


        double z = pbc_rmessage_real(pos, "z", 0);
        (*out)["pos"]["z"] = z;

    }

    {
        struct pbc_rmessage* forward = pbc_rmessage_message(pbc_rmsg, "forward", 0);
        (*out)["forward"] = Json::Value();

        double x = pbc_rmessage_real(forward, "x", 0);
        (*out)["forward"]["x"] = x;


        double y = pbc_rmessage_real(forward, "y", 0);
        (*out)["forward"]["y"] = y;


        double z = pbc_rmessage_real(forward, "z", 0);
        (*out)["forward"]["z"] = z;

    }

    {
        struct pbc_rmessage* velocity = pbc_rmessage_message(pbc_rmsg, "velocity", 0);
        (*out)["velocity"] = Json::Value();

        double x = pbc_rmessage_real(velocity, "x", 0);
        (*out)["velocity"]["x"] = x;


        double y = pbc_rmessage_real(velocity, "y", 0);
        (*out)["velocity"]["y"] = y;


        double z = pbc_rmessage_real(velocity, "z", 0);
        (*out)["velocity"]["z"] = z;

    }

    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_HeartBeat(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_HeartBeat", &slice);


    int id = pbc_rmessage_integer(pbc_rmsg, "id", 0, NULL);
    (*out)["id"] = id;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_EnterScane(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_EnterScane", &slice);


    int sceneId = pbc_rmessage_integer(pbc_rmsg, "sceneId", 0, NULL);
    (*out)["sceneId"] = sceneId;


    {
        struct pbc_rmessage* pos = pbc_rmessage_message(pbc_rmsg, "pos", 0);
        (*out)["pos"] = Json::Value();

        double x = pbc_rmessage_real(pos, "x", 0);
        (*out)["pos"]["x"] = x;


        double y = pbc_rmessage_real(pos, "y", 0);
        (*out)["pos"]["y"] = y;


        double z = pbc_rmessage_real(pos, "z", 0);
        (*out)["pos"]["z"] = z;

    }

    {
        struct pbc_rmessage* forward = pbc_rmessage_message(pbc_rmsg, "forward", 0);
        (*out)["forward"] = Json::Value();

        double x = pbc_rmessage_real(forward, "x", 0);
        (*out)["forward"]["x"] = x;


        double y = pbc_rmessage_real(forward, "y", 0);
        (*out)["forward"]["y"] = y;


        double z = pbc_rmessage_real(forward, "z", 0);
        (*out)["forward"]["z"] = z;

    }

    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_CheckNearPlayers(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_CheckNearPlayers", &slice);


    int sceneId = pbc_rmessage_integer(pbc_rmsg, "sceneId", 0, NULL);
    (*out)["sceneId"] = sceneId;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_Chat(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_Chat", &slice);


    int receiveId = pbc_rmessage_integer(pbc_rmsg, "receiveId", 0, NULL);
    (*out)["receiveId"] = receiveId;


    std::string content = pbc_rmessage_string(pbc_rmsg, "content", 0, NULL);
    (*out)["content"] = content;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_CreateTeam(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_CreateTeam", &slice);


    int userId = pbc_rmessage_integer(pbc_rmsg, "userId", 0, NULL);
    (*out)["userId"] = userId;


    int targetId = pbc_rmessage_integer(pbc_rmsg, "targetId", 0, NULL);
    (*out)["targetId"] = targetId;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_InviteTeam(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_InviteTeam", &slice);


    int myId = pbc_rmessage_integer(pbc_rmsg, "myId", 0, NULL);
    (*out)["myId"] = myId;


    int userId = pbc_rmessage_integer(pbc_rmsg, "userId", 0, NULL);
    (*out)["userId"] = userId;


    int targetId = pbc_rmessage_integer(pbc_rmsg, "targetId", 0, NULL);
    (*out)["targetId"] = targetId;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_DelTeam(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_DelTeam", &slice);


    int teamId = pbc_rmessage_integer(pbc_rmsg, "teamId", 0, NULL);
    (*out)["teamId"] = teamId;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_QuitTeam(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_QuitTeam", &slice);


    int teamId = pbc_rmessage_integer(pbc_rmsg, "teamId", 0, NULL);
    (*out)["teamId"] = teamId;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_OptInviteTeam(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_OptInviteTeam", &slice);


    int teamId = pbc_rmessage_integer(pbc_rmsg, "teamId", 0, NULL);
    (*out)["teamId"] = teamId;


    int opt = pbc_rmessage_integer(pbc_rmsg, "opt", 0, NULL);
    (*out)["opt"] = opt;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_TeamGroupEnterScene(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_TeamGroupEnterScene", &slice);


    int teamId = pbc_rmessage_integer(pbc_rmsg, "teamId", 0, NULL);
    (*out)["teamId"] = teamId;


    int sceneId = pbc_rmessage_integer(pbc_rmsg, "sceneId", 0, NULL);
    (*out)["sceneId"] = sceneId;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_MonsterTrack(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_MonsterTrack", &slice);


    int sceneId = pbc_rmessage_integer(pbc_rmsg, "sceneId", 0, NULL);
    (*out)["sceneId"] = sceneId;


    int monsterId = pbc_rmessage_integer(pbc_rmsg, "monsterId", 0, NULL);
    (*out)["monsterId"] = monsterId;


    int trackId = pbc_rmessage_integer(pbc_rmsg, "trackId", 0, NULL);
    (*out)["trackId"] = trackId;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_MonsterFight(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_MonsterFight", &slice);


    int sceneId = pbc_rmessage_integer(pbc_rmsg, "sceneId", 0, NULL);
    (*out)["sceneId"] = sceneId;


    int monsterId = pbc_rmessage_integer(pbc_rmsg, "monsterId", 0, NULL);
    (*out)["monsterId"] = monsterId;


    int fightId = pbc_rmessage_integer(pbc_rmsg, "fightId", 0, NULL);
    (*out)["fightId"] = fightId;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_LeaveMonsterTrack(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_LeaveMonsterTrack", &slice);


    int sceneId = pbc_rmessage_integer(pbc_rmsg, "sceneId", 0, NULL);
    (*out)["sceneId"] = sceneId;


    int monsterId = pbc_rmessage_integer(pbc_rmsg, "monsterId", 0, NULL);
    (*out)["monsterId"] = monsterId;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::decodeC2S_MonsterLeaveFight(char* buff, int len, pbc_env* env, Json::Value* out)
{
    pbc_slice slice;
    slice.len = len;
    slice.buffer = malloc(slice.len);
    memcpy(slice.buffer, buff, len);
    pbc_rmessage* pbc_rmsg = pbc_rmessage_new(env, "tutorial.C2S_MonsterLeaveFight", &slice);


    int sceneId = pbc_rmessage_integer(pbc_rmsg, "sceneId", 0, NULL);
    (*out)["sceneId"] = sceneId;


    int monsterId = pbc_rmessage_integer(pbc_rmsg, "monsterId", 0, NULL);
    (*out)["monsterId"] = monsterId;


    int success = pbc_rmessage_integer(pbc_rmsg, "success", 0, NULL);
    (*out)["success"] = success;


    pbc_rmessage_delete(pbc_rmsg);
    free(slice.buffer);
}

void DecodeMessageBuffer::initDecodeFunc()
{
    registerDecodeFunc(ID_C2S_Login, &DecodeMessageBuffer::decodeC2S_Login);
    registerDecodeFunc(ID_C2S_GetAllMail, &DecodeMessageBuffer::decodeC2S_GetAllMail);
    registerDecodeFunc(ID_C2S_ReceivetMail, &DecodeMessageBuffer::decodeC2S_ReceivetMail);
    registerDecodeFunc(ID_C2S_GetMail, &DecodeMessageBuffer::decodeC2S_GetMail);
    registerDecodeFunc(ID_C2S_GM_Excute, &DecodeMessageBuffer::decodeC2S_GM_Excute);
    registerDecodeFunc(ID_C2S_Register_User, &DecodeMessageBuffer::decodeC2S_Register_User);
    registerDecodeFunc(ID_C2S_GM_CMD, &DecodeMessageBuffer::decodeC2S_GM_CMD);
    registerDecodeFunc(ID_C2S_UpdatePos, &DecodeMessageBuffer::decodeC2S_UpdatePos);
    registerDecodeFunc(ID_C2S_UpdateVelocity, &DecodeMessageBuffer::decodeC2S_UpdateVelocity);
    registerDecodeFunc(ID_C2S_HeartBeat, &DecodeMessageBuffer::decodeC2S_HeartBeat);
    registerDecodeFunc(ID_C2S_EnterScane, &DecodeMessageBuffer::decodeC2S_EnterScane);
    registerDecodeFunc(ID_C2S_CheckNearPlayers, &DecodeMessageBuffer::decodeC2S_CheckNearPlayers);
    registerDecodeFunc(ID_C2S_Chat, &DecodeMessageBuffer::decodeC2S_Chat);
    registerDecodeFunc(ID_C2S_CreateTeam, &DecodeMessageBuffer::decodeC2S_CreateTeam);
    registerDecodeFunc(ID_C2S_InviteTeam, &DecodeMessageBuffer::decodeC2S_InviteTeam);
    registerDecodeFunc(ID_C2S_DelTeam, &DecodeMessageBuffer::decodeC2S_DelTeam);
    registerDecodeFunc(ID_C2S_QuitTeam, &DecodeMessageBuffer::decodeC2S_QuitTeam);
    registerDecodeFunc(ID_C2S_OptInviteTeam, &DecodeMessageBuffer::decodeC2S_OptInviteTeam);
    registerDecodeFunc(ID_C2S_TeamGroupEnterScene, &DecodeMessageBuffer::decodeC2S_TeamGroupEnterScene);
    registerDecodeFunc(ID_C2S_MonsterTrack, &DecodeMessageBuffer::decodeC2S_MonsterTrack);
    registerDecodeFunc(ID_C2S_MonsterFight, &DecodeMessageBuffer::decodeC2S_MonsterFight);
    registerDecodeFunc(ID_C2S_LeaveMonsterTrack, &DecodeMessageBuffer::decodeC2S_LeaveMonsterTrack);
    registerDecodeFunc(ID_C2S_MonsterLeaveFight, &DecodeMessageBuffer::decodeC2S_MonsterLeaveFight);

}